package com.steak.transaction.rest;

import com.steak.transaction.execute.PlaceOrderExecute;
import com.steak.transaction.result.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘牌
 * @Title:
 * @date 2022/3/19:50
 */
@RestController
@AllArgsConstructor
public class PlaceOrderApi {

    private final PlaceOrderExecute placeOrderExecute;

    @GetMapping("placeOrder")
    public R placeOrder(@RequestParam final Integer userId , @RequestParam final Integer commodityId){
        return placeOrderExecute.execute(userId, commodityId);
    }

    @GetMapping("/useDb")
    public R getUserDbData(){
        return placeOrderExecute.getUser();
    }

    @GetMapping("/defaultDatasource")
    public R defaultDatasource(){
        return placeOrderExecute.defaultDatasource();
    }

}
